package xyz.migle.sc.demo;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DemoController003 {
    private static final Logger logger = LoggerFactory.getLogger(DemoController003.class);

    @GetMapping("/mult")
    public int mult(@RequestParam(name = "a", required = true) int a, @RequestParam(name = "b", required = true) int b) {
        logger.debug("a:{},b:{}",a,b);
        logger.info("a:{},b:{}",a,b);
        logger.warn("a:{},b:{}",a,b);
        logger.error("a:{},b:{}",a,b);
        return a * b;
    }

    @GetMapping("/div")
    public double div(@RequestParam(name = "a", required = true) int a, @RequestParam(name = "b", required = true) int b) {
        logger.debug("a:{},b:{}",a,b);
        logger.info("a:{},b:{}",a,b);
        logger.warn("a:{},b:{}",a,b);
        logger.error("a:{},b:{}",a,b);

        return a*1.0 / b;
    }
}
